package com.dragee.modules.work.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map;
import com.dragee.utils.WrapperUtil;
import com.dragee.common.PageUtils;
import com.dragee.constants.CommonConstants;

import com.dragee.modules.work.dao.TeamOtherDao;
import com.dragee.modules.work.entity.TeamOtherEntity;
import com.dragee.modules.work.service.TeamOtherService;

@Service("teamOtherService")
public class TeamOtherServiceImpl extends ServiceImpl<TeamOtherDao, TeamOtherEntity> implements TeamOtherService {


    @Resource
    private TeamOtherDao teamOtherDao;

    private String business = "teamOther";
    /**
    * 列表
    */
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        int limit = params.get(CommonConstants.LIMIT) == null
                ?CommonConstants.LIMIT_SIZE:Integer.parseInt(params.get(CommonConstants.LIMIT).toString());
        int start = params.get(CommonConstants.START) == null
                ?CommonConstants.START_SIZE:Integer.parseInt(params.get(CommonConstants.START).toString());
        QueryWrapper<TeamOtherEntity> wrapper =
                WrapperUtil.getWrapper(business, params, TeamOtherEntity.class);
        IPage<TeamOtherEntity> page = new Page<>(start, limit);
        page = baseMapper.selectPage(page, wrapper.select());
        return new PageUtils(page);
    }
}